#include "Slots.h"

ostream& operator<<(ostream& os, const Slots& s){
	os << s.size() << "\n";
	for ( Slots::const_iterator i = s.begin(); i != s.end(); i++){
		os << i->first << ";" << i->second.roleName << ";" << i->second.roleIndex << ";" << i->second.semantic << ";"; 
	}
	return os;
}

istream& operator>>(istream& from, Slots& s){
	unsigned int size;
	from >> size;
	char c;

	for( unsigned int i = 0; i < size; i++){
		from.get(c);
		int role = 0;
		string str = getLine(from, ';');

		Slots::iterator current = s.insert(s.lower_bound(str), Slots::value_type(str, Slot()));
		current->second.roleName = getLine(from, ';');
		from >> current->second.roleIndex;
		from.get(c);
		current->second.semantic = getLine(from, ';');
	}
	return from;
}
